<div class='fui-page fui-page-current' ng-if="pagedata.op=='main' && pagedata.setgoods!=1">
	<div class="fui-header">
			<div class="fui-header-left" onclick="window.history.go(-1);">
				<a class="back"></a>
			</div>
			<div class="title">上传作品</div>
			<div class="fui-header-right"></div>
	</div>
	<div class="fui-content">
	<div id="followbar" class="modal fade" tabindex="-1" style="z-index:99999;display:none;position: absolute">
		<div class="modal-dialog" style="width:60%;left:20%">
			<div class="wap-qrcode-container">
				<p class="example1">{{pagedata.pluginset.title || '欢迎浏览'}}</p>
					<div class="wap-qrcode-image">
						<img ng-src="{{tomedia(pagedata.pluginset.ewm) || '../core/resource/images/nopic.jpg'}}"/>
					</div>
				<p class="example1">长按二维码关注</p>
				</div>
		</div>
	</div>
	<div class="weui_cells weui_cells_form">
		<div class="weui_cell weui_vcode">
			<div class="weui_cell_hd"><label class="weui_label">作品名称</label></div>
			<div class="weui_cell_bd weui_cell_primary">
						<input class="weui_input" type="text" ng-model="pagedata.post.title" value="{{pagedata.post.title}}" placeholder="请输入您的作品名称">
			</div>
		</div>
	</div>
	<div class="weui_cells_title">作品描述</div>
	<div class="weui_cells weui_cells_form">
            <div class="weui_cell">
                <div class="weui_cell_bd weui_cell_primary">
                    <textarea class="weui_textarea" ng-model="pagedata.post.description" value="{{pagedata.post.description}}" placeholder="请输入您的作品描述" rows="3"></textarea>
                    <div class="weui_textarea_counter">建议68个字以内！</div>
                </div>
            </div>
    </div>
	<div class="weui_cells_title">发布类型</div>
	<div class="weui_cells weui_cells_radio" style="padding:0.5rem">
			<div class="fui-cell-label" style="margin-right:0.8rem;float:left;margin-bottom:0.2rem">
				<input type="radio" ng-click="pagedata.post.type=0" class="fui fui-radio fui-radio-danger verify-radio" name="radio2" value="0"> 视频
			</div>
			<div class="fui-cell-label" style="margin-right:0.8rem;float:left;margin-bottom:0.2rem">
				<input type="radio" ng-click="pagedata.post.type=1" class="fui fui-radio fui-radio-danger verify-radio" name="radio2" value="1"> 图片
			</div>
	</div>
	<div ng-if="pagedata.post.type==1" class="weui_cells_title">上传参赛图片</div>
	<div ng-if="pagedata.post.type==1" class="weui_cells weui_cells_form">
            <div class="weui_cell">
                <div class="weui_cell_bd weui_cell_primary">
                    <div class="weui_uploader">
                        <div class="weui_uploader_bd">
                            <ul class="weui_uploader_files">
                                <li ng-repeat="p in pagedata.post.opus_images" class="weui_uploader_file" style="background-image:url('{{tomedia(p)}}')">
									<div class="upbtn" >
										<a style="color:#f60" href="javascript:;" ng-click="pagedata.post.opus_images.splice($index-1,0,p);pagedata.post.opus_images.splice($index+1,1)">上移</a>
										<a style="color:#f60" href="javascript:;" ng-click="pagedata.post.opus_images.splice($index,1)">删除</a>
									</div>
								</li>
                            </ul>
                            <div class="weui_uploader_input_wrp" href="javascript:;" ng-click="images(pagedata.post,'opus_images')"></div>
                        </div>
                    </div>
                </div>
            </div>
    </div>
	<div ng-if="pagedata.post.type!=1" class="weui_cells_title">短视频（抖音,微信短视频等）</div>
	<div ng-if="pagedata.post.type!=1" class="weui_cells weui_cells_form">
					<div class="weui_cell">
							<div class="weui_cell_bd weui_cell_primary" style="">
								<ul class="weui_uploader_files" ng-if="pagedata.post.video">
									  <li class="weui_uploader_file" style="width: 108px;height: 60px;background: #333;">
										<video ng-src="{{tomedia(pagedata.post.video)}}" poster="{{tomedia(pagedata.post.thumb)}}" height="60" width="100%"  x5-playsinline="" playsinline="" webkit-playsinline="" poster="" preload="auto"></video>
									  </li>
								</ul>
								<div class="weui_uploader_input_wrp">
									 <input class="weui_uploader_input" ng-click="choose_source(pagedata.post,['video','thumb'],'video')"  multiple="">
								</div>
							</div>
					</div>
	</div>
	<div ng-if="pagedata.post.type!=1" class="weui_cells_title">封面</div>
	<div ng-if="pagedata.post.type!=1" class="weui_cells weui_cells_form">
		<div class="weui_cell">
                <div class="weui_cell_bd weui_cell_primary">
                        <ul ng-if="pagedata.post.thumb" class="weui_uploader_files">
                                <li class="weui_uploader_file" style="background-image:url('{{tomedia(pagedata.post.thumb)}}')">
								</li>
                        </ul>
                         <div class="weui_uploader_input_wrp" href="javascript:;" ng-click="image(pagedata.post,'thumb')"></div>
                </div>
        </div>
	</div>
	<div class="weui_cells_title">选择商品</div>
	<div class="weui_cells weui_cells_form">
		<div class="weui_cell">
                <div class="weui_cell_bd weui_cell_primary">
                        <ul ng-if="pagedata.post.goods.image" class="weui_uploader_files">
                                <li class="weui_uploader_file" style="background-image:url('{{tomedia(pagedata.post.goods.image)}}')">
								</li>
                        </ul>
                         <div class="weui_uploader_input_wrp" href="javascript:;" onclick="$('#selectgoods').modal();"></div>
                </div>
        </div>
	</div>
	<div ng-repeat="item in pagedata.post.fileds">
			<div class="weui_cells weui_cells_form" ng-if="item.type == 1 || item.type == 9">
            <div class="weui_cell">
                <div class="weui_cell_hd"><label class="weui_label">{{item.title}}<span ng-if="item.is_must" class="must"></span></label></div>
                <div class="weui_cell_bd weui_cell_primary">
                    <input class="weui_input" type="text" ng-model="item.data" placeholder="输入{{item.title}}内容">
                </div>
            </div>
			</div>
			<div class="weui_cells weui_cells_form" ng-if="item.type == 2 || item.type == 8 || item.type == 18">
			 <div class="weui_cell" ng-if="item.type == 2 || item.type == 8 || item.type == 18">
                <div class="weui_cell_hd"><label class="weui_label">{{item.title}}<span ng-if="item.is_must" class="must"></span></label></div>
                <div class="weui_cell_bd weui_cell_primary">
                    <input class="weui_input" type="number" ng-model="item.data" placeholder="输入{{item.title}}内容">
                </div>
            </div>
			</div>
			<div class="weui_cells weui_cells_form" ng-if="item.type == 3">
			<div class="weui_cell" ng-if="item.type == 3">
					<div class="weui_cell_hd"><label class="weui_label">{{item.title}}<span ng-if="item.is_must" class="must"></span></label></div>
					<div class="weui_cell_bd weui_cell_primary">
						<ul class="weui_uploader_files" ng-if="item.data">
							  <li class="weui_uploader_file" style="background-image:url({{tomedia(item.data)}})"></li>
						</ul>
						<div class="weui_uploader_input_wrp">
							 <input class="weui_uploader_input" ng-click="image(item,'data')" accept="image/jpg,image/jpeg,image/png,image/gif" multiple="">
						</div>
					</div>
			</div>
			</div>
				<div ng-if="item.type == 4" class="weui_cells_title">{{item.title}}<span ng-if="item.is_must" class="must"></span></div>
				<div ng-if="item.type == 4" class="weui_cells weui_cells_radio2">
						<label class="weui_cell weui_check_label dashed" ng-repeat="(key,value) in item.value">

							<div class="weui_cell_bd weui_cell_primary">
								<span style="float:left;width:100%">{{value}}</span>
							</div>
							<div class="weui_cell_ft" href="javascript:;"  ng-click="item.data=value;">
								<input type="radio" class="weui_check" name="radio1">
								<span class="weui_icon_checked"></span>
							</div>
						</label>
				</div>	
				<div ng-if="item.type == 5" class="weui_cells_title">{{item.title}}<span ng-if="item.is_must" class="must"></span></div>
				<div ng-if="item.type == 5" class="weui_cells weui_cells_checkbox" style="padding:0.5rem">
						<div class="fui-cell-label" style="margin-right:0.8rem;float:left;margin-bottom:0.2rem" ng-repeat="(key,value) in item.value">
							<input type="checkbox" ng-click="duoxuans(value,item,'data')" class="fui fui-checkbox fui-checkbox-danger verify-checkbox" value="{{key}}" id="s11"> {{value}}
						</div>
				</div>
				<div ng-if="item.type == 6" class="weui_cells_title">{{item.title}}<span ng-if="item.is_must" class="must"></span></div>
				<div ng-if="item.type == 6" class="weui_cells weui_cells_form">
				<div class="weui_cell">
						<div class="weui_cell_bd weui_cell_primary">
							<textarea class="weui_textarea" ng-model="item.data" placeholder="请输入{{item.title}}" rows="2"></textarea>
							<div class="weui_textarea_counter"><span>0</span>/118</div>
						</div>
					</div>
				</div>
				<div ng-if="item.type == 7" class="weui_cells_title">{{item.title}}<span ng-if="item.is_must" class="must"></span></div>
				<div ng-if="item.type == 7" class="weui_cells weui_cells_form" ng-init="pagedata.getlocation($index)">
					<div class="weui_cell">
						<div class="fui-cell-label" style="width:33%">
							<select ng-model="item.data.province" class="form-control tpl-province">
							<option value="" selected="selected">省份</option>
							<option ng-repeat="(value,data) in pagedata.province" value="{{value}}" ng-selected="item.data.province==value">{{value}}</option>
							</select>
						</div>
						<div class="fui-cell-label" style="width:33%">
							<select ng-model="item.data.city" class="form-control tpl-city">
							<option value="" selected="selected">城市</option>
							<option ng-repeat="(value,data) in pagedata.province[item.data.province]" value="{{value}}" ng-selected="item.data.city==value">{{value}}</option>
							</select>
						</div>
						<div class="fui-cell-label" style="width:33%">
							<select ng-model="item.data.district" class="form-control tpl-district">
							<option value="" selected="selected">区县</option>
							<option ng-repeat="(value,data) in pagedata.province[item.data.province][item.data.city]" value="{{value}}" ng-selected="item.data.district==value">{{value}}</option>
							</select>
						</div>
						<div class="fui-cell-label" style="width:28%">
							<select ng-model="item.data.street" class="form-control tpl-district">
							<option value="" selected="selected">街道</option>
							<option ng-repeat="value in pagedata.province[item.data.province][item.data.city][item.data.district]" value="{{value}}" ng-selected="item.data.street==value">{{value}}</option>
							</select>
						</div>
					</div>
					<div class="weui_cell_bd weui_cell_primary">
                    <input class="weui_input" type="text" ng-model="item.data.xiangxi" placeholder="输入详细地址">
                </div>
				</div>
				<div class="weui_cells weui_cells_form" style="padding:0;margin-top:0.3rem" ng-if="item.type == 10">
					<div class="weui_cell">
						<div class="weui_cell_bd weui_cell_primary" style="padding:0;padding-bottom:0.3rem">
							<div class="weui_label" style="margin-bottom:0.3rem"><span>{{item.title}}</span></div>
							<div class="weui_uploader">
								<div class="weui_uploader_bd">
									<ul class="weui_uploader_files">
										<li ng-repeat="p in item.data track by $index" class="weui_uploader_file" style="background-image:url('{{tomedia(p)}}')">
											<div class="upbtn" >
												<i class="icon icon-shangyi" style="color:#f60" href="javascript:;" ng-click="item.data.splice($index-1,0,p);item.data.splice($index+1,1)"></i>
												<i class="icon icon-close" style="color:#f60" href="javascript:;" ng-click="item.data.splice($index,1)"></i>
											</div>
										</li>
									</ul>
									<div class="weui_uploader_input_wrp" href="javascript:;" ng-click="images(item,'data')">
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
				<div class="weui_cells weui_cells_form" style="padding:0;margin-top:0.3rem" ng-if="item.type == 11">
					<div class="weui_cell">
							<div class="weui_cell_bd weui_cell_primary" style="">
								<div class="weui_label" style="margin-bottom:0.3rem"><span>{{item.title}}</span></div>
								<ul class="weui_uploader_files" ng-if="item.data">
									  <li class="weui_uploader_file" style="width: 108px;height: 60px;background: #333;">
										<video ng-src="{{tomedia(item.data)}}" poster="{{tomedia(item.thumb)}}" height="60" width="100%"  x5-playsinline="" playsinline="" webkit-playsinline="" preload="auto"></video>
									  </li>
								</ul>
								<div class="weui_uploader_input_wrp" ng-if="!item.data">
									 <input class="weui_uploader_input" ng-click="pagedata.up_file($index)"  multiple="">
								</div>
							</div>
					</div>
				</div>
				<div class="weui_cells weui_cells_form" ng-if="item.type == 13">
				<div class="weui_cell">
					<div class="weui_cell_hd"><label class="weui_label">{{item.title}}<span ng-if="item.is_must" class="must"></span></label></div>
					<div class="weui_cell_bd weui_cell_primary">
						<input class="weui_input" type="text" ng-model="item.data" placeholder="输入{{item.title}}">
					</div>
					<div class="weui_cell_ft" ng-click="tool.choose_location(item,'data','address')"><i class="icon jinyunicon icon-ditu"></i></div>
				</div>
				</div>
        </div>
	<div class="weui_cells">
	<div class="weui_cell weui_cell_switch">
                <div class="weui_cell_hd weui_cell_primary">是否公开</div>
                <div class="weui_cell_ft">
                    <input class="weui_switch" type="checkbox" ng-checked="pagedata.post.isshow==1" ng-click="toogle(pagedata.post,'isshow',[0,1])">
                </div>
    </div>
	</div>
	<div class="weui_btn_area">
			 <a class="weui_btn weui_btn_primary" href="javascript:" id="showTooltips" ng-click="pagedata.setvote()">提交</a>
	</div>
</div>
</div>
<div id="selectgoods" class="modal fade" tabindex="-1" style="z-index:99999;display:none;">
<div class="modal-dialog" style="width:100%;left:0;bottom:0">
<div class="modal-bottom" style="background:#f9f9f9;">
	<div class="fui-content navbar">
	<div class="fui-fullHigh-group" >
        <div class="fui-fullHigh-item menu" id="tab">
            <nav ng-class="{'on':pagedata.ctype =='all'}" ng-click="pagedata.getlist('all',0)">全部商品</nav>
			<nav ng-class="{'on':pagedata.ctype =='isnew'}" ng-click="pagedata.getlist('isnew',0)">新上宝贝</nav>
			<nav ng-class="{'on':pagedata.ctype =='isrecommand'}" ng-click="pagedata.getlist('isrecommand',0)">推荐宝贝</nav>
			<div ng-repeat="c1 in pagedata.category">
				<nav ng-class="{'on':pagedata.ctype ==c1.id}" ng-click="pagedata.getlist('',c1.id)" ng-show="!c1.enabled && pagedata.shopset.category.level !='-1'">{{c1.title}}</nav>
				<div ng-repeat="c2 in pagedata.category.childs[c1.id]">
					<nav ng-class="{'on':pagedata.ctype ==c2.id}" ng-click="pagedata.getlist('',c2.id)" ng-show="!c2.enabled && pagedata.shopset.category.level>=2">{{c2.title}}</nav>
					<nav ng-repeat="c3 in pagedata.category.childs[c2.id]" ng-class="{'on':pagedata.ctype ==c3.id}" ng-click="pagedata.getlist('',c3.id)" ng-show="!c3.enabled && pagedata.shopset.category.level>=3">{{c3.title}}</nav>
				</div>
			</div>
        </div>
        <div class="fui-fullHigh-item container modal-swiper-y">
				<p ng-if="pagedata.list.length<1" class="text-center text-cancel empty" style="margin-top:2rem;color:#999">暂时没有任何商品</p>
				<div class="fui-list-group goods-list-group" style="margin-top:0;">
					<div ng-repeat="g in pagedata.list" class="fui-list goods-item" aria-hidden="true" data-dismiss="modal" ng-click="pagedata.selectgoods(g);">
							<div class="fui-list-media">
								<img ng-src="{{tomedia(g.image) || '../core/resource/images/nopic.jpg'}}" class='round'/>
							</div>
							<div class='fui-list-inner'>
								<div class='subtitle'>{{g.title}}</div>
								<div class='text'><span class='text-danger'>￥{{g.price}}</span></div>
								
							</div>
					</div>
				</div>
				<div ng-if="loading" class='infinite-loading'><span class='fui-preloader'></span><span class='text'> 正在加载...</span></div>
	   
        </div> 
    </div>
	<div class="fui-navbar">
		<a aria-hidden="true" data-dismiss="modal" ng-click="access_json('jy_commission/myshop//&plugin_name=jy_videoshop')" class="nav-item btn btn-success confirmbtn">进入我的小店</a>
	</div>
	</div>
</div>
</div>
</div>
<div ng-include="sys_html('_footer')"></div>
<script>
scope.pagedata.getlocation=function(index){
	if(scope.pagedata.os !='wxapp'){
		window.scope.location(function(re){
			scope.pagedata.post.fileds[index].data={};
				scope.pagedata.post.fileds[index].data.province = re.addressComponents.province
				scope.pagedata.post.fileds[index].data.city = re.addressComponents.city
				scope.pagedata.post.fileds[index].data.district = re.addressComponents.district
			scope.$apply();
		});
	}
		
}
//提交留言
scope.pagedata.setvote=function(msg){
	var params={
		data:scope.pagedata.post,
		op:'main',
		callback:function(res){
			if(res.needfollow =='1'){
				scope.confirm({
					'message':'请先关注，再投票吧！',
					'success':function(){
						$('#followbar').modal();
					},
					'fail':function(){}
				});
			}
		}
	};
	scope.post_json(params);
}
scope.pagedata.getfileds = function(id){
		var params = {
					'plugin':'jy_vote',
					'action':'upopus',
					'op':'getfileds',
					'query':'id='+id,
					'data':{},
					'callback':function(data){
							//console.log(data)
							if(data.success == 1){
								scope.pagedata.post.fileds = data.post.fileds;
								scope.$evalAsync();
							}
					}
		}
		scope.post_json(params);
}
scope.pagedata.selectgoods=function(goodsinfo){
	scope.pagedata.post.goods=goodsinfo;
}
scope.loading = true;  //状态标记
scope.isnodata = false;
scope.pagedata.list =[];
scope.pagedata.ctype ='all'
//滚动加载
scope.pagedata.params = {};
scope.pagedata.params.keyword = ''
var page = 1;
scope.pagedata.getlist=function(order,cid){
		if(order){
			page = 1;
			scope.pagedata.list =[];
			scope.pagedata.ctype =order
		}else if(cid){
			page = 1;
			scope.pagedata.list =[];
			scope.pagedata.ctype =cid
		}
		scope.get('jy_commission/myshop/list/page='+page+'&keyword='+scope.pagedata.params.keyword+'&order='+order+'&cid='+cid+'&frommerch=true',
				function(data){	
					if(data.error !=1){
								for (var i=0;i<data.length;i++){
									scope.pagedata.list.push(data[i]);
								}
								if(page >1){
									$("#goodslist").animate({scrollTop:0},300);
								}
								if(data.length<1){
									scope.isnodata=true;
								}
								page++;
								scope.loading = false;
								scope.$evalAsync();
								//getmpmansory();
							}else{
								console.log('error!');
							};
			});
}
scope.pagedata.getlist('all');
scope.pagedata.scroll_bottom=function(){
		if(!scope.isnodata && !scope.loading){
			scope.pagedata.getlist();
		}
}
scope.pagedata.up_file=function(index){
	if(index){
		scope.choose_source(scope.pagedata.post.fileds[index],['data','thumb'],'video');
	}else{
		scope.choose_source(scope.pagedata.post,['video','thumb'],'video');
	}
}
</script>